{include file='public/header'}
{include file='public/list'}
 <!--state overview end-->            <div class="row">
                <div class="col-lg-12">
                    <!--work progress start-->
                    <section class="panel">
                        <div class="panel-body progress-panel">
                            <div class="task-progress">
                                <h1>添加新产品</h1>
                                <p>填写产品信息并保存.</p>
                            </div>
                        </div>
						<form action="" method="post"  id="form">
                            <div class="form-group">
                                <label for="txtDomain">产品</label>
                                <input type="text" name="cp" class="form-control" placeholder="输入产品名称">
                            </div>
                            <div class="form-group">
                                <label for="txtDomain">描述</label>
                                <input type="text" name="ms" class="form-control" placeholder="输入描述">
                            </div>

			<div id="bottom" >
			  <a class="btn btn-info" value="true" id="submit" onclick='prod_add()'/><strong>添加产品</strong></a>
            </div>
                        </form>
                    </section>
                    <!--work progress end-->
                </div>

        </section>
    </section>
    <!--main content end-->
{include file='public/footer'}
<script type="text/javascript">
function prod_add(){
    var cp = $("input[name='cp']").val();
    var ms = $("input[name='ms']").val();
    if(cp==''){
        layer.msg('产品名称不能为空!',{icon: 2,time:1000});
        return false;
    }
    $.ajax({
        type: 'post',
        url: '{:url("admin/products/add")}',
        data: $('#form').serialize(),
        success: function(data){
            if(data.code==1){
                layer.msg(data.msg, 
                {icon:1,time:1000},function(){
                     window.location.href = data.url;});
            }else{
                layer.msg(data.msg, 
                {icon:2,time:1000});   
            }
        }
    });
}     
</script>